<?php require_once(dirname(__FILE__).'/inc/config.inc.php');IsModelPriv('config_var_list'); 
$vargroup = isset($vargroup) ? $vargroup : '';
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,initial-scale=1.0,user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<title>系统变量管理</title>
<link href="templates/css/style.css" rel="stylesheet" type="text/css" />
<link href="templates/css/pagination.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" charset="utf-8" src="templates/js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/layindex.js"></script>
<script type="text/javascript" charset="utf-8" src="templates/js/common.js"></script>
<script type="text/javascript" src="templates/js/forms.func.js"></script>
<script type="text/javascript">

function checkPagenum(id)
{	
	var pn = document.getElementById(id).value; 
	var url=window.location.search;
	location.href=changeURLArg(url,'checkPagenum',pn);
};

function func(id){
 //获取被选中的option标签
	var val = $('#'+id+' option:selected').val();
	var url=window.location.search;
	location.href=changeURLArg(url,id,val);
};
</script>
</head>

<body class="mainbody">
<!--导航栏-->
<div class="location">
  <a href="javascript:history.back(-1);" class="back"><i></i><span>返回上一页</span></a>
  <a href="home.php" class="home"><i></i><span>首页</span></a>
  <i class="arrow"></i>
  <span>系统变量管理</span>
  <a href="javascript:location.reload();" class="reload">刷新</a>
</div>
<!--/导航栏-->

<!--工具栏-->
<div id="floatHead" class="toolbar-wrap">
  <div class="toolbar">
    <div class="box-wrap">
      <a class="menu-btn"></a>
      <div class="l-list">
        <ul class="icon-list">
          <li><a class="add" href="config_var_add.php"><i></i><span>新增</span></a></li>
		  <li><a id="btnSave" class="save" href="javascript:UpOrderID('config_var_save.php');"><i></i><span>保存</span></a></li>
        </ul>
		 <div class="menu-list">
          <div class="rule-single-select">
          <select name="vargroup" onchange="javascript:func('vargroup')" id="vargroup">
		<option selected="selected" value="all">全部分组...</option>
		  <?php
	  //设置选项卡项
		$config_tab_arr = array('基本设置','附件设置','性能设置','URL静态化','核心设置');
		//统计当前数组数量
		$config_tab_num = count($config_tab_arr);

		foreach($config_tab_arr as $config_tab_id=>$config_tab_text)
		{	$config_tab_id=$config_tab_id+1;
			if($vargroup==$config_tab_id) $selected ='selected="selected"'; else $selected='';
			echo '<option '.$selected.' value="'.$config_tab_id.'">'.$config_tab_text.'</option>';	
		}
		?>

		</select>
          </div>
          <div class="rule-single-select">
     <select name="checkinfo" onchange="func('checkinfo')" id="checkinfo">
		<option selected="selected" value="">审核状态</option>
		<option <?php if(@$checkinfo=='false') echo 'selected="selected"';?> value="false">未审核</option>
		<option <?php if(@$checkinfo=='true') echo 'selected="selected"';?> value="true">已审核</option>
	</select>
          </div>
        </div>

      </div>
      <div class="r-list">
	  <form name="form3" id="form3" method="post" action="config_var.php">
        <input name="keyword" type="text" id="keyword" class="keyword" />
        <input  class="btn-search" type="submit" value="搜索" style="cursor:pointer;">
		</form>
      </div>
    </div>
  </div>
</div>
<!--/工具栏-->
<form method="post"  id="form">
<!--列表-->
<div class="table-container">

  <table width="100%" border="0" cellspacing="0" cellpadding="0" class="ltable">
    <tr>
      <th width="8%">所属站点</th>
	   <th align="left" width="12%">参数说明</th>
      <th align="left">变量名称</th>
      <th align="left" width="8%">变量类型</th>
      <th width="10%">所属组</th>
      <th width="8%">状态</th>
      <th width="8%">排序</th>
      <th width="8%">操作</th>
    </tr>
  
  	<?php

		$sql = "SELECT * FROM `#@__webconfig`  where id>0";

	$checkPagenum = !isset($checkPagenum)?  $cfg_pagenum : $checkPagenum ;
	if(!empty($keyword)) $sql .= " and (varname LIKE '%$keyword%' or varinfo LIKE '%$keyword%' )";
	if(!empty($checkinfo)) $sql .= " and `checkinfo` =  '$checkinfo'";
	if(!empty($vargroup) and  $vargroup!='all') $sql .= " and vargroup=($vargroup-1)";
	$dopage->GetPage($sql,$checkPagenum,'ASC','orderid,id');
	while($row = $dosql->GetArray())
	{
		switch($row['vargroup'])
		{
			case '0':
				$vargroup = '基本设置';
				break;  
			case '1':
				$vargroup = '附件设置';
				break;
			case '2':
				$vargroup = '性能设置';
				break;
			case '3':
				$vargroup = 'URL静态化';
				break;
			case '4':
				$vargroup = '核心设置';
				break;
			default:
				$vargroup = '没有获取到参数';
		}

	?>
	 <tr>
      <td align="center">
        <?php echo $row['siteid']; ?>
      </td>
	   <td><?php echo $row['varinfo']; ?><input type="hidden"  name="id[]"id="id[]" value="<?php echo $row['id']; ?>" /></td>
      <td><a href="config_var_update.php?id=<?php echo $row['id']; ?>"><?php echo $row['varname']; ?></a></td>
     
	   <td><?php echo $row['vartype']; ?></td>
      <td align="center"><?php echo $vargroup; ?></td>
      <td align="center"><?php echo $row['checkinfo']; ?></td>
      <td align="center"><input type="text" name="orderid[]" id="orderid[]" class="sort" value="<?php echo $row['orderid']; ?>" /></td>

    <td align="center"><span><a href="config_var_update.php?id=<?php echo $row['id']; ?>">修改</a></span> | <a href="config_var_save.php?action=dell&id=<?php echo $row['id'] ?>" onclick="return ConfDel(0);">删除</a></td>
    </tr>

	<?php
	}
	?>

  </table>
  
</div>
<!--/列表-->

<!--内容底部-->
<div class="line20"></div>
<div class="pagelist">
  <div class="l-btns">
    <span>显示</span><input name="txtPageNum" type="text" value="<?php echo $checkPagenum;?>"  onblur="checkPagenum(this.id)"  onkeypress="if (WebForm_TextBoxKeyHandler(event) == false) return false;" id="txtPageNum" class="pagenum" onkeydown="return checkNumber(event);" /><span>条/页</span>
  </div>
  <?php echo $dopage->GetList($sql,$checkPagenum); ?>

</div>
<!--/内容底部-->
</form>
</body>
</html>
